Displaying graphs


In [1]:
%matplotlib inline

In [5]:
import matplotlib
import numpy as np
import matplotlib.pyplot as plt

In [6]:
x=list(range(10))
print(x)


[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

In [7]:
y=[10,5,5,8,9,1,2,3,4,8]

In [10]:
plt.plot(x, y)
plt.show()



In [14]:
from math import cos

y=list()
x=list()
for i in range(500):
    x.append(i)
    y.append(cos(i/10.0))

In [15]:
y[1:10]


Out[15]:
[0.9950041652780258,
 0.9800665778412416,
 0.955336489125606,
 0.9210609940028851,
 0.8775825618903728,
 0.8253356149096783,
 0.7648421872844885,
 0.6967067093471654,
 0.6216099682706644]

In [16]:
plt.plot(x, y)
plt.show()



In [55]:
from math import exp
y1=list()
y2=list()
x=list()
for i in range(500):
    x.append(i)
    carrier = cos(i/10.0)
    signal = exp(-abs(i-250)/100.0)
    y1.append(signal)
    y2.append(carrier*signal)
plt.plot(x, y1)
plt.plot(x, y2)
plt.show()



In [60]:
plt.plot(x, y1 , label = "signal")
plt.plot(x, y2, label = "final")
plt.legend(loc='upper right')
plt.show()


Title

Bla bla bla

title2

More interesting stuff


In [ ]: